/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function(){
    $('#title').blur(function(){
        $.post(
            '/scrumEgg/posts/validate_form',
            {field: $('#title').attr('id'), value: $('#title').val()},
            handleNameValidation
        )
    })
    function handleNameValidation(error){
        if(error.length>0){
            if($('#title-notEmpty').length==0){
                $('#title').after('<div id="title-notEmpty" class="error-message">'+error+'</div>');
            }
            else{
                $('#title-notEmpty').remove();
            }
        }
    }
});